package com.train.classeval.controller;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.train.classeval.entity.RatingsItems;
import com.train.classeval.service.impl.RatingsItemsServiceImpl;
import com.train.classeval.util.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xs
 * @since 2021-10-23
 */
@RestController
public class RatingsItemsController {

    @Autowired
    private RatingsItemsServiceImpl ratingsItemsService;

    /**
     * 查询所有评价条款
     * @return
     */
    @GetMapping("/findAllRatings")
    public JsonData findAllRatings() {
        final List<RatingsItems> list = ratingsItemsService.list();
        if (list != null) {
            return JsonData.BuildSuccess(list, "查询成功!");
        }
        return JsonData.BuildError("查询失败");
    }
}
